package com.star.rpc.registry;

import com.star.rpc.config.RegistryConfig;
import com.star.rpc.modal.ServiceMetaInfo;

import java.util.List;
import java.util.concurrent.ExecutionException;

/**
 * packageName com.star.rpc.registry
 *
 * @author zerostart
 * @className Registry
 * @date 2024/11/22
 * @description 注册中心
 */
public interface Registry {

    /**
     * 初始化
     */
    void init(RegistryConfig registryConfig);

    /**
     * 注册服务
     * @param serviceMetaInfo
     */
    void register(ServiceMetaInfo serviceMetaInfo) throws Exception;

    /**
     * 注销服务
     * @param serviceMetaInfo
     */
    void unRegister(ServiceMetaInfo serviceMetaInfo);


    /**
     * 服务发现
     * @param serviceKey
     * @return
     */
    List<ServiceMetaInfo> serviceDiscovery(String serviceKey);

    /**
     * 销毁
     */
    void destroy();


    /**
     * 心跳检测
     */
    void heartBeat();


    /**
     * 监听
     * @param serviceNodeKey
     */
    void watch(String serviceNodeKey);
}
